GBML manual / Strings

string_trim

s with any leading/trailing spaces removed - trimming, e.g. cleaning up a name typed on an entry screen.

Syntax

string_trim(s) -> string

Arguments

NameType
sstring

Returns

string

Description

s with any leading/trailing spaces removed - trimming, e.g. cleaning up a name typed on an entry screen.

Only the plain space character counts as whitespace. A new line ("\n", see Special characters in a string) is a character like any other, so it is not trimmed off.

Example

var typed = "  Ripley  ";
var cleaned = string_trim(typed);
var has_content = string_length(cleaned) > 0;

On the GBA

Only the plain space character (0x20) counts as whitespace - GBML has no escape for a tab or newline inside a string, and nothing on this hardware types one into a runtime string either.

See also: string_join